﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core;

namespace DataAccess
{
    public class InfoLop
    {
        private string _MaLop;

        public string MaLop
        {
            get { return _MaLop; }
            set { _MaLop = value; }
        }
        private string _TenLop;

        public string TenLop
        {
            get { return _TenLop; }
            set { _TenLop = value; }
        }
        public InfoLop()
        { }
        // Xuat tat ca cac danh sach lop
        public static List<InfoLop> DanhSachLop()
        {
            return CBO.FillCollection<InfoLop>(DataProvider.Instance.ExecuteReader("Lop_Select"));
        }
        //Them mot lop
        public static int AddLop(InfoLop infolop)
        {
            return DataProvider.Instance.ExecuteNonquery("Lop_Add",infolop.MaLop,infolop.TenLop);
        }
        // Xoa mot lop
        public static int DeleteLop(string delete)
        {
            return DataProvider.Instance.ExecuteNonquery("Lop_Delete", delete);
        }
        //Update mot giao vien
        public static int UpdateLop(InfoLop infolop)
        {
            return DataProvider.Instance.ExecuteNonquery("Lop_Update", infolop.MaLop, infolop.TenLop);
        }
        public static List<InfoLop> TimLopTheoMa(string ma)
        {
            return CBO.FillCollection<InfoLop>(DataProvider.Instance.ExecuteReader("Lop_TimKiemTheoMa", ma));
        }
    }
}
